<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app';
import { reactive } from "vue";
import api from '@/api'; // 导入 API 对象
const state = reactive({
  title: '',
  content: ''
})
onLoad((options: any) => {
  const {slug} = options
  getDetail(slug)
})

const getDetail = async (slug: string) => {
  const { code,data } = await api.data.richtext(slug)
  if (code == 1) {
    state.title = data.title
    state.content = data.content
    uni.setNavigationBarTitle({
      title: data.title
    })
  }
}

</script>

<template>
  <view class="up-content">
    <up-parse :content="state.content" ></up-parse>
  </view>
</template>

<style scoped>
.up-content {
  padding: 20rpx;
}
</style>